home *** CD-ROM | disk | FTP | other *** search
- # This script is Public Domain => You should Modify it !!!
- # It makes a recursive listing of a dir using xList
-
- # main:
-
- if $_version < 520
- echo "This script needs at least Csh 5.20"
- return 0
- endif
-
- echo "Csh script for xList 1.05"
-
- if -v 1 # if arg detected
- if -nd $1 # if arg is not a dir
- set arg1 @filereq( "Select a directory to scan:" ) # popup FileReq.
- if $arg1 = ""
- echo "*** No dir selected."
- return 0
- endif
- else # else it is a dir
- set arg1 $1 # store dir in var 2
- endif
- else # no args: popup filerequester
- set arg1 @filereq( "Select a directory to scan:" )
- if $arg1 = ""
- echo "*** No dir selected."
- return 0
- endif
- endif
-
- label mychkdir # going to check if it is really a dir
-
- if -nd $arg1
- set arg1 @filereq( "Select a directory to scan:" )
- goto mychkdir
- endif
-
- date -s
- resident c:xList >nil:
-
- goto init_aliases
- label init1_done
- goto init_variables
- label init2_done
-
- echo Scanning dir...
- ls >t:x2 -cghz "%m%-16n%.5w " $arg1 # building index
- init
- tackon wildcard $arg1 ".../*"
- ls -cqhnd $wildcard | readfile alldirs # finding dirs and subdirs
- foreach i ( $alldirs ) "cmplx $i"
- end
-
- return 0
- ###########
-
- # subroutines:
-
- label init_aliases
-
- set stk ""
- alias pushd "%a set stk $_cwd @subwords( $stk 1 10 );\\cd $a
- alias popd "\\cd @first( $stk );set stk @subwords( $stk 2 10 )
-
- alias init {
- echo "" >$dest2
- echo -n >>$dest2 " Listing on: "
- day $dest2
- echo >>$dest2 ""
- }
- # insert in the alias above 'type >$dest2 "my_intro"'
- #
-
- alias day {
- %f
- unset dat2
- echo >env:dat2 `date`
- strlen slen $dat2
- dec slen 9
- strleft dat2 $dat2 $slen
- echo >>$f $dat2
- delete >nil: env:dat2
- }
-
- alias end {
- echo `date -r` >env:da1
- echo @nameroot( $da1 ) >env:da2
- echo Elapsed time: @rpn( $da2 60 / ) min @rpn( $da2 60 % ) s.
- echo >>$dest2 Total number of files: $ntotal
- echo >>$dest2 ""
- echo >>$dest2 "--------------------------------- ·I·N·D·E·X· ---------------------------------
- cat >>$dest2 t:x2
- echo >>$dest2 "-------------------------------------------------------------------------------
- echo Total number of files: $ntotal
- cat >>$dest2 $dest
- delete >nil: env:da1 env:da2 $dest t:x2 t:c1
- shcrunch
- resident -r xList >nil:
- unset alldirs choice wildcard dat2 dummy dest dest2 nli nline1 ntotal packer 2 tmp slen
- return 0
- }
-
- # insert 'type >>$dest2 "my_endtext"' in the alias above, before 'shcrunch'
- #
-
- alias shcrunch {
- if -f c:xpk
- set packer 1
- goto crunching
- else
- if -f c:packx
- set packer 2
- goto crunching
- endif
- endif
- return 0
-
- label crunching
- echo -n "Crunch the list (with xpkNUKE) ? (y/N): "
- input -r choice
- if -n $choice = y
- echo ""
- return 0
- else
- echo Crunching...
- if $packer = 1
- c:xpk -m NUKE $dest2
- else
- c:packx $dest2 lib=nuke
- endif
- endif
- }
-
- alias cmplx {
- %i
- echo $i
- xList >>$dest $i LF=4 DL
- inc ntotal $xltotal
- label endloop
- }
-
- #goto nocomms # -(2)-
- label commsdone
- goto init1_done
-
-
- label init_variables
- set dest2 ram:Listing.txt
- set dest t:listx
- set tmp t:c1
- echo -n >$dest ""
- echo -n >$dest2 ""
- echo -n >$tmp ""
- set ntotal 0
- set dummy yes
- goto init2_done
-
- # tHanX for reading this up to the end, mate !
- # *** Signoff: Reez, the mad modulelister (&raytracoder)
-